<?
//检查是否有权限
//include_once("../../../common/modules/checkA.php");
//$_REQUEST['athloncode']="circledesign";
//$_REQUEST['date']="2023-07-10";



//获取根目录的系统设置文件
include_once("../../../config.php");
include_once("../../connection.php");

$seo['description'] = "";
$seo['keyword']     = "";
$seo['title']       = "天宫信息科技";

//传递的是周一的日期。显示需要减一天

$date_start=date("Y-m-d",strtotime("-7 day"  ,strtotime($_REQUEST['date'])));
$date_end=date("Y-m-d",strtotime("-1 day"  ,strtotime($_REQUEST['date'])));

$month_start=date("Y-m",strtotime($_REQUEST['date']));




$_SESSION['database'] = $_unit[$_REQUEST['athloncode']]['database'];
//只在登录的时候需要再引入一次。登录之后就会产生session，会在config中引入
include_once (ROOT_PATH_."/front/connection.php");



$data['title']="周报";


//用户数量
$member_num = count_by_item($table_prefix . "member", "nid > 0");
$member_unarrange = count_by_item($table_prefix . "member", "agentnid < 0 or agentnid is null");



$member  =select_lines_all_items($table_prefix."member","","date > '".$date_start."' and date < '".$_REQUEST['date']."' ","");

$member  =select_lines_all_items($table_prefix."member","","date > '".$date_start."' and date < '".$_REQUEST['date']."' ","");
$message =select_lines_all_items($table_prefix."member_contact_log","","date > '".$date_start."' and date < '".$_REQUEST['date']."' and contact_way = '网站留言'  ","");


$member_month  =select_lines_all_items($table_prefix."member","","date > '".$month_start."'","");
$message_month =select_lines_all_items($table_prefix."member_contact_log","","date > '".$month_start."' and contact_way = '网站留言'  ","");


$member_overtime =select_lines_all_items($table_prefix."member","","checkpoint < '".$date_end."'","");


//业务员
$employee=select_lines_all_items($table_prefix."employee","","nid >0 and status = '在职'","");

//统计各自用户跟进的客户
foreach ($employee as $k=>$v)
{
    $employee_static[$k]['name']    =$v['name'];
    $employee_static[$k]['sum']     =count_by_item($table_prefix."member","agentnid = '".$v['nid']."' ");
    $employee_static[$k]['overtime']=count_by_item($table_prefix."member","agentnid = '".$v['nid'] ."' and checkpoint < '".$date_end."'");
}
sort($employee_static);



//获取板块的设置
include_once("../../../controller/extender/member/controller/model/setting.php");

$rank_list = explode(';',$member_setting['rank']);

?>




